var xhr = new XMLHttpRequest();

xhr.open('GET','https://api.vvhan.com/api/weather?city=长沙&type=week');
xhr.onload=()=>{
    if(xhr.status===200){
        var str = xhr.responseText;
        page(str);
    }else{
        console.error("Error");
    }
}
xhr.send();

function page(str){
    var obj = JSON.parse(str);
    for(var d in data){
        document.write("<h1>"+d.date+"</h1>");
    }
}






